package com.nextive.interview.service;

import com.nextive.interview.dto.UserPreferences;

/**
 * Interface for all services related to user preferences.
 * 
 * @author Cesar Roman
 *
 */
public interface UserInfoService {
	
	/**
	 * Default metric value.
	 */
	Metric DEFAULT_METRIC = Metric.KG;

	/**
	 * User preferences enum keys.
	 */
	enum UserInfoKey {
		
		/**
		 * Enum value to identify shared preferences name.
		 */
		USER_INFO_PREFERENCES,
		
		/**
		 * Name preference key enum value.
		 */
		NAME,

		/**
		 * Email preference key enum value.
		 */
		EMAIL,
		
		/**
		 * Recipient email preference key enum value.
		 */
		RECIPIENT,
		
		/**
		 * Weight metric option preference key enum value.
		 */
		WEIGHT_METRIC;
		
	}
	
	/**
	 * Metric enum options.
	 */
	enum Metric {
		
		/**
		 * Kilograms enum value.
		 */
		KG,
		
		/**
		 * Pounds enum value.
		 */
		LB;

	}

	/**
	 * Checks whether it is user first time access to the app.
	 * @return true if first access
	 */
	boolean isUserFirstAccess();
	
	/**
	 * It saves/updates user preferences into disk.
	 * @param preferences to be saved
	 * @return true if saved correctly
	 */
	boolean saveOrUpdateUserInfo(UserPreferences preferences);
	
	/**
	 * It fetchs user preferences.
	 * @return
	 */
	UserPreferences fetchUserInfo();
	
}
